Ext.define('appmod.controller.knowledge.logs.Startup', {
    extend: 'Ext.app.Controller',
    
   	stores:[
		'knowledge.logs.Page'
   	],   

    views: [
		'knowledge.logs.Dashboard'
    ],
	

    refs: [
		{ref: 'knowledgeLog', selector: 'knowledge-logs-dashboard'}
    ],	

    init: function() {
		var me = this;

    	me.control({

			'knowledge-logs-dashboard button[action=reflashLogs]' : {
				click: {
					fn:me.reflashLogs,
					scope:me
				}
			},			
			'knowledge-logs-dashboard button[action=addLogs]': {
				click:{
					fn:me.showLogsAddingForm,
					scope:me
				}
			},
			'knowledge-logs-dashboard button[action=saveLogsUpdate]': {
				click:{
					fn:me.saveLogsUpdate,
					scope:me
				}
			},
			'knowledge-logs-dashboard button[action=deleteLogs]': {
				click:{
					fn:me.showDeleteLogsDialog,
					scope:me
				}
			},
			'knowledge-logs-dashboard menuitem[action=assign]': {
				click:{
					fn:me.showAssignForm,
					scope:me
				}
			},
			'knowledge-logs-dashboard button[action=Userassign]': {
				click:{
					fn:me.showUserAssignForm,
					scope:me
				}
			}		
    	});
    },

	
	/**
	 * load main compont in this controller to framework container
	 */
	loadInitComp : function() {
		var me = this;
		// --- defined store ---
		var mainPanel = Ext.create('appmod.view.knowledge.logs.Dashboard' , {
			region : 'center',
			border:false,
			padding:'0 0 0 0'
		});
		return mainPanel;		
	},
	

	// --- use this app lication
	onLaunch:function(app) {
		var me = this;
		var dsLogs = me.getKnowledgeLogsPageStore();
		var knowledgeLogPanel = me.getKnowledgeLog();
		knowledgeLogPanel.bindStore(dsLogs);
		alert(dsLogs.getCount());
		
	},
	reflashLogs:function(){
		var me = this;
		var formPanel = win.down("logs-editingform");
		var form = formPanel.getForm();
		form.load({
			params:{
				Id:rec[0].getId()
			},
			url: '../../data/resource/knowledge/logs/page_logs.json',
            waitMsg: '数据加载中'
		});
		if ( !win.isVisible() ) {
			win.show();			
		}
	}
});